

const VerifyUtils= {


    //公用提示

    tips:(ctx,...params)=>{

        let resObj=Object.assign({},...params)
        let keys=Object.keys(resObj)

        for(let i=0; i<params.length; i++){
            let key=keys[i]
            let item=params[i]

            if(!item[key]){

                ctx.body={
                    code:11,
                    msg:`缺少参数${key}`
                }
                ctx.throw(400);
            }
        }
    },



    login:(ctx,pic,username,uid)=>{

         if(!pic){

             ctx.body={
                 code:11,
                 msg:"缺少参数pic"
             }

             ctx.throw(400);

         }

         if(!username){
             ctx.body={
                 code:11,
                 msg:"缺少参数username"
             }
             ctx.throw(400);
         }

         if(!uid){
             ctx.body={
                 code:11,
                 msg:"缺少参数uid"
             }
             ctx.throw(400);
         }
    }

}



module.exports=VerifyUtils

